package com.code.aicodemother.service;

/**
 * 验证码服务接口
 *
 * @author ys
 */
public interface CaptchaService {

    /**
     * 生成验证码
     *
     * @return 验证码图片的Base64编码和验证码key
     */
    CaptchaResult generateCaptcha();

    /**
     * 校验验证码
     *
     * @param captchaKey 验证码key
     * @param captchaCode 用户输入的验证码
     * @return 校验结果
     */
    boolean verifyCaptcha(String captchaKey, String captchaCode);

    /**
     * 验证码生成结果
     */
    class CaptchaResult {
        private String captchaKey;
        private String captchaImage;

        public CaptchaResult(String captchaKey, String captchaImage) {
            this.captchaKey = captchaKey;
            this.captchaImage = captchaImage;
        }

        public String getCaptchaKey() {
            return captchaKey;
        }

        public void setCaptchaKey(String captchaKey) {
            this.captchaKey = captchaKey;
        }

        public String getCaptchaImage() {
            return captchaImage;
        }

        public void setCaptchaImage(String captchaImage) {
            this.captchaImage = captchaImage;
        }
    }
}
